package yag.battle;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import yag.battle.model.Army;
import yag.battle.pet.manager.PetManager;
import yag.battle.pet.model.Equipment;
import yag.battle.pet.model.Pet;
import yag.battle.pet.model.PetType;
import yag.battle.manager.ArmyManager;
import yag.battle.manager.BattleManager;

/**
 * Created by user on 25.08.2014.
 */
public class Main {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("./config/applicationContext.xml");
        ArmyManager armyManager = applicationContext.getBean(ArmyManager.class);
        PetManager petManager = applicationContext.getBean(PetManager.class);
        BattleManager battleManager = applicationContext.getBean(BattleManager.class);

//        // pet and equipment creator *****
//        Pet pet1 = petManager.createPet(PetType.CAT);
//        Equipment eq1 = petManager.createEquipment("Cat Sword2");
//        Pet pet2 = petManager.createPet(PetType.DOG);
//        Equipment eq2 = petManager.createEquipment("Dog tail2");
//        //********************************

//        // set pet equipment *************
        //       petManager.setPetEquipment(pet1, eq1);
        //       petManager.setPetEquipment(pet2, eq2);
//        //********************************
//
//        // set pet user id (army id)******
        // ручной способ;
        // при назначении армии питомца у него автоматическо ставиться номер армии.
        // Номер можыт быть только у одного питомца.
//        petManager.setPetUserId(pet1.getId(), 1);
//        petManager.setPetUserId(pet2.getId(), 2);
//        //********************************

        armyManager.createArmy(1, 1, 1, null);
        armyManager.createArmy(2, 1, 1, null);

        Army army1 = armyManager.getArmy(1);
        Army army2 = armyManager.getArmy(2);

        System.out.println(army1);
        System.out.println(army2);

        battleManager.battle(army1, army2);
    }
}
